//
// Created by korack on 25-5-21.
//

#ifndef BUTTONS_H
#define BUTTONS_H

#include "config.h"

typedef struct _Buttons Buttons;

//
extern Buttons *buttons_new_from_global(void);

typedef void (*ButtonIRQHandler)(void *object, uint8_t which_button);
#define BUTTON_IRQ_HANDLER(any) ((ButtonIRQHandler)(any))

/**
 * @brief 连接到一个对象和钩子
 * @param self 按钮对象
 * @param object 触发按钮时连接到的对象
 * @param handler 触发按钮时的对象钩子
 */
extern void
buttons_connect_handler(Buttons *self, void *object, ButtonIRQHandler handler);

#endif // BUTTONS_H
